<#include "/common/pagerForm.html">
<form rel="pagerForm" method="post" action="" onsubmit="return navTabSearch(this)">
    <div class="pageHeader">
        <div class="searchBar">
            <ul class="searchContent">
            <li>
                <label>
                    <@label key='taskCode.C,colon'>任务编号：</@label>
                </label>
                <input type="text" name="taskCode" value="${condition.taskCode!''}"/>
            </li>
            <li>
                <label>
                    <@label key='equipmentCode.C,colon'>设备编号：</@label>
                </label>
                <input type="text" name="equipmentCode" value="${condition.equipmentCode!''}"/>
            </li>
            <li>
                <label>
                    <@label key='equipmentText.C,colon'>设备描述：</@label>
                </label>
                <input type="text" name="equipmentText" value="${condition.equipmentText!''}"/>
            </li>
            </ul>
            <ul class="searchContent">
            <li><label><@label key="statusECode.C,colon">任务状态：</@label></label> <select name="statusECode">
                        <option value=""><@label key="all.C">所有</@label></option> <#list status as types>
                        <option value="${types.eCode}"<#if condition.statusECode?? && condition.statusECode == types.eCode> selected="selected"</#if>>${types.eCodeText}</option> </#list>
                </select>
                </li>
                <li><label><@label key="plannedMaintainDate.C,colon">计划维护日期：</@label></label> 
                <input type="text" readonly="readonly" style="background-color:#fff;" name="plannedMaintainDateSt" dateFmt="yyyy-MM-dd" class="date" value="<#if (condition.plannedMaintainDateSt)??>${condition.plannedMaintainDateSt?string("yyyy-MM-dd")}</#if>" /> <a class="inputDateButton" href="javascript:;"><@label key="select.B">选择</@label></a>
                </li>
                <li>
                <label><@label key="to.C,colon">至：</@label></label>
                <input  type="text" readonly="readonly" style="background-color:#fff;" name="plannedMaintainDateEn" dateFmt="yyyy-MM-dd" class="date" value="<#if (condition.plannedMaintainDateEn)??>${condition.plannedMaintainDateEn?string("yyyy-MM-dd")}</#if>" /> <a class="inputDateButton" href="javascript:;"><@label key="select.B">选择</@label></a>
                </li>
                <li class="query">
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit"><@label key="query.B">查询</@label></button>
                        </div>
                    </div>
                </li>    
            </ul>
        </div>
    </div>
    </form>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <@buttonRight menuCode="MAINTAINTASK_ADD" labelKey="add.B" defalutName="新增">
            <li><a class="add" target="dialog" mask="true" width="640" height="310" rel="task_tab" href="${rc.getContextPath()}/manage/maintainTask/addMaintainTask?navTabId=${navTabId!''}" title="<@label key='addMaintainTask.D'>新增维护任务</@label>"><span><@label key="add.B">新增</@label></span> </a>
            </li> </@buttonRight> 
            <@buttonRight menuCode="MAINTAINTASK_EXECUTE" labelKey="execute.B" defalutName="执行">
            <li><a class="do" target="selectedTodo" callback="batchjobAjaxDone" href="${rc.getContextPath()}/manage/maintainTask/executeMaintainTask?navTabId=${navTabId!''}" postType="string" rel="ids" title="<@label key='confirmExecuteMaintainTask.M'>确认要执行选择的维护任务吗？</@label>"><span><@label key="execute.B">执行</@label></span> </a>
            </li> </@buttonRight>
            
            <@buttonRight menuCode="MAINTAINTASK_INPUT" labelKey="input.B" defalutName="录入">
            <li><a class="edit" target="dialog" mask="true" width="640" height="580" preevent="taskJs._checkInputButtonEnable" rel="task_tab" href="${rc.getContextPath()}/manage/maintainTask/modifyMaintainTask?id={task_code}&navTabId=${navTabId!''}" title="<@label key='editMaintainTask.D'>维护任务录入</@label>"><span><@label key="input.B">录入</@label></span> </a>
            </li> </@buttonRight> 
            
            <@buttonRight menuCode="MAINTAINTASK_CANCEL" labelKey="cancel.B" defalutName="取消">
            <li><a class="delete" target="selectedTodo" callback="batchjobAjaxDone" href="${rc.getContextPath()}/manage/maintainTask/cancelMaintainTask?id={task_code}&navTabId=${navTabId!''}" postType="string" rel="ids" title="<@label key='confirmCancelMaintainTask.M'>确认要取消选择的维护任务吗？</@label>"><span><@label key="cancel.B">取消</@label></span> </a>
            </li> </@buttonRight>
            
            <@buttonRight menuCode="MAINTAINCONFIG_VIEW" labelKey="view.B" defalutName="详情">
            <li><a class="icon" target="dialog" mask="true" width="640" height="600" rel="task_tab" href="${rc.getContextPath()}/manage/maintainTask/viewMaintainTask?id={task_code}&navTabId=${navTabId!''}" title="<@label key='viewMaintainTask.D'>维护任务详情</@label>"><span><@label key="view.B">详情</@label></span> </a>
            </li> </@buttonRight> 
        </ul>
    </div>
    <table class="table" width="1200px" layoutH="160" style="overflow: scroll;">
        <thead>
            <tr>
                <th width="22"><input type="checkbox" group="ids" class="checkboxCtrl">
                </th>
                <th width="40"><@label key="serialNumber.C">序号</@label></th>
                <th width="100" orderField="taskCode"<#if (page.orderField?? && page.orderField == 'taskCode')>class="${page.orderDirection!''}"</#if>><@label key="taskCode.C">equipmentCode任务编号</@label></th>
                <th width="100" orderField="equipmentCode"<#if (page.orderField?? && page.orderField == 'equipmentCode')>class="${page.orderDirection!''}"</#if>><@label key="equipmentCode.C">设备编号</@label></th>
                <th width="100" orderField="equipmentText"<#if (page.orderField?? && page.orderField == 'equipmentText')>class="${page.orderDirection!''}"</#if>><@label key="equipmentText.C">设备描述</@label></th>
                <th width="100" orderField="strategyCode"<#if (page.orderField?? && page.orderField == 'strategyCode')>class="${page.orderDirection!''}"</#if>><@label key="strategyCode.C">维护策略编号</@label></th>
                <th width="100" orderField="strategyText"<#if (page.orderField?? && page.orderField == 'strategyText')>class="${page.orderDirection!''}"</#if>><@label key="strategyText.C">维护策略描述</@label></th>    
                <th width="80" orderField="plannedMaintainDate"<#if (page.orderField?? && page.orderField == 'plannedMaintainDate')>class="${page.orderDirection!''}"</#if>><@label key="plannedMaintainDate.C">计划维护日期</@label></th>
                <th width="120" orderField="maintainStartDateTime"<#if (page.orderField?? && page.orderField == 'maintainStartDateTime')>class="${page.orderDirection!''}"</#if>><@label key="maintainStartDateTime.C">实际维护开始时间</@label></th>    
                <th width="120" orderField="maintainEndDateTime"<#if (page.orderField?? && page.orderField == 'maintainEndDateTime')>class="${page.orderDirection!''}"</#if>><@label key="maintainEndDateTime.C">实际维护结束时间</@label></th>
                <th width="80" orderField="statusECode"<#if (page.orderField?? && page.orderField == 'statusECode')>class="${page.orderDirection!''}"</#if>><@label key="statusECode.C">任务状态</@label></th>    
    
            </tr>
        </thead>
        <tbody>
            <#if page??><#if (page.data?size>0)> <#list page.data as task>
            <tr target="task_code" rel="${task.taskCode!''}">
                <td><input name="ids" value="${task.taskCode!''}" type="checkbox"></td>
                <td>${page.startRow + task_index}</td>
                <td>${task.taskCode!''}</td>
                <td>${task.equipmentCode!''}</td>
                <td>${task.equipmentText!''}</td>
                <td>${task.strategyCode!''}</td>
                <td>${task.strategyText!''}</td>
                <td>${(task.plannedMaintainDate?string("yyyy-MM-dd"))?if_exists}</td>
                <td>${(task.maintainStartDateTime?string("yyyy-MM-dd HH:mm:ss"))?if_exists}</td>
                <td>${(task.maintainEndDateTime?string("yyyy-MM-dd HH:mm:ss"))?if_exists}</td>
                <td>${task.statusECodeText!''}</td>
                

            </tr>
            </#list> <#else>
            <tr target="task_code">
                <td colspan="6" class="noData">======<@label key="noListData.C">列表无数据</@label>=====</td>
            </tr>
            </#if> <#else>
            <tr target="task_code">
                <td colspan="6" class="noData">======<@label key="noListData.C">列表无数据</@label>=====</td>
            </tr>
            </#if>
        </tbody>
    </table>
    <#include "/common/panelBar.html">
</div>

<script type="text/javascript">

var taskJs = {
        inputEnable : true,
        _checkInputButtonEnable:function(){
            var id = $("#task_code", navTab.getCurrentPanel()).val();
            taskJs.inputEnable = true;
            if(id && id!=""){
                $.ajax({
                    async : false,
                    dataType : "json",
                    url:hostUrl +"/maintainTask/checkedButtonEnable",
                    data:{'taskCode':id},
                    success:function(data){
                        if(data.statusCode == DWZ.statusCode.error){
                            taskJs.inputEnable = false;
                            alertMsg.error(data.message);
                        }
                    }
                });
            }
            return taskJs.inputEnable;
        }
}

</script>